#!/bin/bash

mkdir -p /git-cache/ci-plugins/git-clone-yyds/master

cd /git-cache/ci-plugins/git-clone-yyds/
umount test/workspace
rm -rf test/

docker pull orangeci/git-clone-yyds:dev

docker run --rm \
    -e TZ=Asia/Shanghai \
    --privileged \
    \
    -v /git-cache/ci-plugins/git-clone-yyds/master:/git-cache/ci-plugins/git-clone-yyds/master \
    -v $(pwd):/yyds:rshared \
    -e PLUGIN_GIT_DOAMIN="github.com" \
    -e PLUGIN_GIT_CACHE="/git-cache/ci-plugins/git-clone-yyds/master" \
    -e PLUGIN_WORKSPACE_ID="test" \
    -e PLUGIN_WORKSPACE_NAME="workspace" \
    \
    -e PLUGIN_BUILD_USER="testuser" \
    -e PLUGIN_GIT_PROTOCOL="git" \
    -e PLUGIN_GIT_SSH_PRIVATE_KEY=${GIT_SSH_PRIVATE_KEY} \
    -e PLUGIN_NO_CHECK_AUTH=true \
    \
    -e PLUGIN_SOURCE_URL="git@github.com:Tencent/TSW.git" \
    -e PLUGIN_SOURCE_REF="master"  \
    -e PLUGIN_SOURCE_SHA="" \
    \
    -e PLUGIN_TARGET_URL="git@github.com:Tencent/TSW.git" \
    -e PLUGIN_TARGET_REF="master" \
    -e PLUGIN_TARGET_SHA="" \
    \
    -e PLUGIN_NEED_MERGE="false" \
    -e PLUGIN_NEED_SUBMODULE="true" \
    -e PLUGIN_NEED_LFS="true" \
    \
    orangeci/git-clone-yyds:dev
